//
//  XLReChagerModel.m
//  XiangLove
//
//  Created by 宋振 on 2018/8/3.
//  Copyright © 2018年 BAOMIHUA.COM. All rights reserved.
//

#import "XLReChagerModel.h"

@implementation XLReChagerModel

- (NSString *)CreateTime
{
    
    //创建时间
    //分割时间 2018  -  08  -  03 17:40:12
    NSArray *timesOne = [K_DEFULT(_CreateTime) componentsSeparatedByString:@"-"];
    
    //分割时间 2018-08-03     17:40:12
    NSArray *timeTwo = [K_DEFULT(_CreateTime) componentsSeparatedByString:@" "];
    
    NSString *year= nil;
    NSString *moth = nil;
    NSString *day = nil;
    
    if (timesOne.count > 0) {
        
        for (NSInteger i = 0; i < timesOne.count; i++) {
            
            //08
            if (i == 0) {
                year = [timesOne[i] substringFromIndex:2];
            }else if(i == 1){
                //08
                moth = timesOne[i];
            }else{
                //03
                day = [timesOne[i] substringToIndex:2];
            }
            
        }
        
    }
    
    // 时 分
    
    NSString *h = nil;
    NSString *m = nil;
    
    if (timeTwo.count > 0) {
        
        NSArray *timeThree = [timeTwo[1] componentsSeparatedByString:@":"];
        
        //分割 17:40:12 组合成 17:40
        for (NSInteger i = 0; i < timeThree.count; i ++) {
            
            if (i == 0) {
                h = timeThree[i];
            }else if (i == 1)
            {
                m = timeThree[i];
            }
            
        }
        
    }
    
    NSString *hm = [NSString stringWithFormat:@"%@:%@",h,m];
    
    NSString *time = [NSString stringWithFormat:@"%@.%@.%@ %@",year,moth,day,hm];
    
    return time;
}

@end
